<?php

namespace app\common\model\gaokao;

use think\Model;


class Zhiyuan extends Model
{

    

    

    // 表名
    protected $name = 'gaokao_zhiyuan';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'type_text',
        'stu_type_text',
        'grade_text',
        'identy_text',
        'status_text'
    ];
    

    
    public function getTypeList()
    {
        // return ['baoming' => __('Type baoming'), 'qiangji' => __('Type qiangji'), 'zonghe' => __('Type zonghe'), 'all' => __('Type all')];
        return ['baoming' => __('Type baoming'), 'zonghe' => __('Type zonghe'), 'all' => __('Type all')];
    }

    public function getStuTypeList()
    {
        return ['wen' => __('Stu_type wen'), 'li' => __('Stu_type li'), 'art' => __('Stu_type art'), 'other' => __('Stu_type other'), 'spo' => __('Stu_type spo')];
    }

    public function getGradeList()
    {
        return ['1' => __('Grade 1'), '2' => __('Grade 2'), '3' => __('Grade 3')];
    }

    public function getIdentyList()
    {
        return ['1' => __('Identy 1'), '2' => __('Identy 2'), '3' => __('Identy 3'), '4' => __('Identy 4')];
    }

    public function getStatusList()
    {
        return ['0' => __('Status 0'), '1' => __('Status 1')];
    }


    public function getTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
        $list = $this->getTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStuTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['stu_type']) ? $data['stu_type'] : '');
        $list = $this->getStuTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getGradeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['grade']) ? $data['grade'] : '');
        $list = $this->getGradeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getIdentyTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['identy']) ? $data['identy'] : '');
        $list = $this->getIdentyList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
